<template>
    <view>
        <view class="banner-box">
        	<image src="/static/stu/point.png" mode="widthFix"></image>
			<view class="total-point">
				<text>当前积分</text>
				<view class="number">
					<text>{{zScore}}</text>
				</view>
			</view>
        </view>
		<view class="details">
			<view class="title">
				<text>积分详情</text>
			</view>
			<view class="item" v-for="item in list" :key="item.id">
				<view class="desc">
					<text>{{item.name}}</text>
					<text class="tips">{{item.tips}}</text>
				</view>
				<text class="point">{{scoreDetails[item.type]}}积分</text>
			</view>
		</view>
    </view>
</template>
<script>
export default {
    data() {
        return {
			list: [{name: '运动', tips: '每日运动签到加1分', type: 'exerciseMark', id: 1}, {name: '任务', tips: '根据导师赋分情况加分', type: 'taskMark', id: 2}, {name: '活动', tips: '每次参加活动加3分', type: 'activityEMark', id: 3}], // // 获得积分类型
			studentId: '', // 学生的账号id
			scoreDetails: {}, // 积分详情
			zScore: 0, // 总积分
        }
    },
	onLoad(options){
		this.studentId = options.accountId
		this.getScoreDetails()
	},
	methods: {
		// 积分详情
		getScoreDetails(){
			this.api.get('statistics/scoreDetails', {
				accountId: this.studentId
			}).then(res => {
				if(res.data.state == 'ok'){
					this.scoreDetails = res.data;
					this.zScore = this.scoreDetails.activityEMark + this.scoreDetails.exerciseMark + this.scoreDetails.taskMark
				}
			})
		},
	}
}
</script>
<style lang="less" scoped>
	.banner-box{
		position: relative;
		padding-top: 20rpx;
		margin: 0 24rpx;
		image{
			width: 100%;
		}
	}
	.total-point{
		position: absolute;
		top: 55rpx;
		left: 34rpx;
		color: #666;
		font-size: 32rpx;
		line-height: 45rpx;
		.number{
			margin-top: 26rpx;
			lighting-color: 48rpx;
			font-weight: bold;
			font-size: 42rpx;
			color: #333;
		}
	}
	.details{
		margin: 60rpx 24rpx 0;
	}
	.title{
		font-size: 30rpx;
		font-weight: bold;
		line-height: 42rpx;
		padding-bottom: 20rpx;
	}
	.item{
		margin: 36rpx 8rpx 0;
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		line-height: 38rpx;
		font-weight: bold;
		color: #162641;
		font-size: 30rpx;
		position: relative;
		padding-bottom: 24rpx;
		&::after{
			position: absolute;
			content: '';
			left: 0;
			bottom: 0;
			width: 200%;
			height: 2rpx;
			background-color: #F0F0F0;
			transform: scale(0.5) translateX(-50%);
		}
		.point{
			font-size: 32rpx;
			color: #28C2CD;
		}
	}
	.tips{
		margin-top: 24rpx;
		display: block;
		font-size: 26rpx;
		color: #999999;
		font-weight: normal;
	}
</style>